package com.limh.gobang.service

import android.os.Parcel
import android.os.Parcelable

/**
 * @author limh
 * @function
 * @date 2018/4/27 14:44
 */
class WebConfiguration() :Parcelable {
    var address: String = ""
    /**
     * 端口
     */
    var port: Int = 0
    /**
     * 最大监听数
     */
    var maxParallels: Int = 0

    constructor(parcel: Parcel) : this() {
        address = parcel.readString()
        port = parcel.readInt()
        maxParallels = parcel.readInt()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeInt(port)
        parcel.writeInt(maxParallels)
    }

    override fun describeContents(): Int {
        return 0
    }

    override fun toString(): String {
        return "WebConfiguration(address='$address', port=$port, maxParallels=$maxParallels)"
    }

    companion object CREATOR : Parcelable.Creator<WebConfiguration> {
        override fun createFromParcel(parcel: Parcel): WebConfiguration {
            return WebConfiguration(parcel)
        }

        override fun newArray(size: Int): Array<WebConfiguration?> {
            return arrayOfNulls(size)
        }
    }


}
